From 37455c343614ded2788380973c0c5334fa6cb796 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 5 Aug 2009 13:49:35 +0100 Subject: [PATCH] x86: Enable GNTTABOP_copy hypercall for HVMs This requires plumbing 32-bit compat guests through the compat version of teh grant-table hypercall. Signed-off-by: Jayaraman, Bhaskar --- xen/arch/x86/hvm/hvm.c | 15 +++++++++++++-- xen/include/xen/hypercall.h | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 1716b14b2d..16f59b2780 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1999,7 +1999,8 @@ static long hvm_grant_table_op( unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) { if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) && - (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) ) + (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) && + (cmd != GNTTABOP_copy)) return -ENOSYS; /* all other commands need auditing */ return do_grant_table_op(cmd, uop, count); } @@ -2051,6 +2052,16 @@ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { #else /* defined(__x86_64__) */ +static long hvm_grant_table_op_compat32( + unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) +{ + if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) && + (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) && + (cmd != GNTTABOP_copy)) + return -ENOSYS; /* all other commands need auditing */ + return compat_grant_table_op(cmd, uop, count); +} + static long hvm_memory_op_compat32(int cmd, XEN_GUEST_HANDLE(void) arg) { long rc = compat_memory_op(cmd, arg); @@ -2090,7 +2101,7 @@ static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = { static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = { [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op_compat32, - [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, + [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op_compat32, [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op_compat32, HYPERCALL(xen_version), HYPERCALL(event_channel_op), diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index f2e0150fa1..5d151226e9 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -128,6 +128,12 @@ compat_memory_op( unsigned int cmd, XEN_GUEST_HANDLE(void) arg); +extern int +compat_grant_table_op( + unsigned int cmd, + XEN_GUEST_HANDLE(void) uop, + unsigned int count); + extern int compat_vcpu_op( int cmd, -- 2.30.2